package summary;


import java.util.Arrays;

/**
 * @Author: 海琳琦
 * @Date: 2022/6/8 16:46
 */
public class Title506 {

    public String[] findRelativeRanks(int[] score) {
        int n = score.length;
        int[][] arr = new int[n][2];
        String[] desc = {"Gold Medal", "Silver Medal", "Bronze Medal"};
        for (int i = 0; i < n; i++) {
            arr[i][0] = score[i];
            arr[i][1] = i;
        }
        Arrays.sort(arr, (a, b) -> (b[0] - a[0]));
        String[] result = new String[n];
        for (int i = 0; i < n; i++) {
            if (i < 3) {
                result[arr[i][1]] = desc[i];
            }else{
                result[arr[i][1]] = String.valueOf(i + 1);
            }
        }
        return result;
    }

    public static void main(String[] args) {

    }
}
